package prova;


public class Batch implements Runnable{

	public int id;
	
	public Batch(int x){
		this.id=x;
	}
	
	
	
	public static void main(String[]asd){
		Thread t=new Thread(new Batch(1));
		t.start();
	}
	
	
	@Override
	public synchronized void run() {
		try{
			System.out.println(id+ " started");
			this.wait(1000);
			System.out.println("...");
			IteratoreFromXtoY it=new IteratoreFromXtoY(100001,200000);
			
			int step=0;
			
			while(it.hasNext()){
				step++;
				System.out.println(it.next());
			}
			
			System.out.println("total iteration: "+step);
		}
		catch(InterruptedException ecc){
			ecc.printStackTrace();
		}
	}
	
	

}
